/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controlador;

import Modelo.Listas;
import Modelo.Rutas;
import Vista.JFrameRutas;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;


public class ControladorRutas implements ActionListener,KeyListener
{
    private JFrameRutas formRutas;
    private LinkedList<Rutas> listaRutas;

           public ControladorRutas(LinkedList<Rutas> lisRut) 
     {
        listaRutas = lisRut;
        formRutas = new JFrameRutas();
        formRutas.agregarListener(this, this);
        formRutas.setVisible(true);
        Enabled(false);
      
        
        formRutas.getTxtCodigoR().addKeyListener(new KeyAdapter() 
        {
            public void keyTyped(KeyEvent e) 
            {
               // CodigoRKeyTyped(e);
            }

            public void keyPressed(KeyEvent e) {

               // CodigoRkeyPressed(e);
            }
        });
     }
    //----------------------------------------------
           private void Enabled(boolean Status) 
    {
        formRutas.getTxtCodigoR().setEnabled(!Status);
        formRutas.getTxtDestinoR().setEnabled(Status);
        formRutas.getCmbEstadoR().setEnabled(Status);
        formRutas.getCmbDescripcionR().setEnabled(Status);
    }
    
           //Limpia el contenido de las cajas de texto
    //------------------------------------------
    private void Limpiar() {
        formRutas.getTxtCodigoR().setText("");
        formRutas.getTxtDestinoR().setText("");
        
    }

    //-----------------------------------------------

    //Ingresa una nueva ruta en la lista de choferes
    //------------------------------------------------
    private void Grabar() 
    {
        
    }
//-------------------------------------------     
    @Override
    public void actionPerformed(ActionEvent e) 
     {
        if (e.getSource().equals(formRutas.getBtnBuscarR()))
      {
         new ControladorConsulRutas(listaRutas);  
      }
    }

    @Override
    public void keyTyped(KeyEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void keyPressed(KeyEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void keyReleased(KeyEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}